<%-- 
    Document   : courierDboardMain
    Created on : Apr 20, 2013, 1:39:21 PM
    Author     : Andriy
--%>

<%@page import="entity.Orders"%>
<%@page import="java.util.Iterator"%>
<%@page import="java.util.List"%>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="css/courier.css">
        <title>Courier Dashboard</title>
    </head>
    <body>
        <header>
            <div id ="top_name"> <h1> Courier Dashboard</h1> </div>
            <div id="user-panel">
                <p> <a href="user_name.jsp">User name</a>
                    <a href="main.jsp">LogOut</a> </p>
            </div>
            </header>
        
        <div id="main">
            <form action="courier" method="GET" name="drop_down_box">
                <select name="sort" size="1">
                    <option selected value="IdOrder">#Order</option>
                    <option  value="OrderDate">Order Date</option>
                    <option value="IdWarehouse">Warehouse</option>
                    <option value="Address">Address</option>
                    <option value="ShippingPrice">Shipping price</option>
                    <option value="ProductPrice">Product price</option>
                </select>
                <select name="by" size="1">
                    <option selected value="asc">asc</option>
                    <option  value="desc">desc</option>
                </select>
                <input type="submit" value="Sort"/> 
            </form>
             <div id="role"> <select name="rol" size = 1> 
                        <option value=”1”>Customer</option>
                        <option value=”2”>Warehouse Employee</option> 
                        <option value=”3”>Courier</option> 
                        <option value=”4”, selected>Admin</option> 
                            </select> </div>
            <div id="tabl" >

                <table width="90%">

                    <TR>
                        <td id="head_table_first" >Order </td>
                        <td id="head_table_first">Order Date </td>
                        <td id="head_table_first">  Order Status</td>
                        <td id="head_table_first">Warehouse </td>
                        <td id="head_table_first">Address </td>
                        <td id="head_table_first">  Shipping price</td>
                        <td id="head_table_first">  Product price</td>
                        <td id="head_table_first">Delivery </td>
                    </TR>

                    <% List<Orders> ordersList = (List) request.getAttribute("ordersList");
                        for (Iterator<Orders> itr = ordersList.iterator(); itr.hasNext();) {
                            Orders o = itr.next();%>
                    <TR>
                        <td id="colomn_first" > <%=o.getIdOrder()%></td>   
                        <td id="colomn_first" > <%=o.getOrderDate()%></td>  
                        <td id="colomn_first" > <%=o.getOrderStatus()%></td> 
                        <td id="colomn_first" > <%=o.getIdWarehouse().getName()%></td> 
                        <td id="colomn_first" > <%=o.getAddress()%></td>
                        <td id="colomn_first" > <%=o.getShippingPrice()%></td>
                        <td id="colomn_first" > <%=o.getProductPrice()%></td>
                        <td id="colomn_first">
                            <form method="GET" action="courier">
                                <input type="hidden" name="idOrderDel" value="<%=o.getIdOrder()%>"/>
                                <input type="submit" value="Detail"/> 
                            </form>
                        </td>
                    </TR>
                    <%}%>
                </table> 
                <%for (int i = 1; i <= ((Integer) request.getAttribute("count") / 10) + 1; i++) {%>
                <a href=<%= "\"/Delta-war/courier?page=" + i + "\""%> >[<%=i%>]</a>
                <%}%>
            </div>

        </div>
    </body>
</html>
